package com.housesales.web;

import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpSession;

import module.Content;
import module.Employees;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import domain.vo.ContentQueryObject;
import domain.vo.ContentVO;
import domain.vo.EmployeesQueryObject;
import domain.vo.EmployeesVO;
import bussinessService.basicbussinessService;
import bussinessService.contentBussinessService;
import bussinessService.employeesBussinessService;
import bussinessService.impl.ContentBussinessServiceImpl;
import bussinessService.impl.EmployeesBussinessServiceImpl;

/**
 * 
* @ClassName: IndexController
* @Description:IndexController
* @author chenchao
* @date 2013-12-17 上午08:29:54
*
 */
@Controller
@RequestMapping("/sy")
public class IndexController {
	private Logger logger = Logger.getLogger(IndexController.class.getName());
	/**
	 * 员工业务层实现类
	 */
	private basicbussinessService<Employees,EmployeesVO> empBIS = new EmployeesBussinessServiceImpl();
	
	@RequestMapping("/index")
	public ModelAndView  index(HttpSession session) {
		ModelAndView mv = new ModelAndView();
		mv.setViewName("index/index");
	
		String e_sn = session.getAttribute("e_sn").toString();
		try {	 	
			//员工
			Employees emp;
			emp = empBIS.getById(e_sn);
			mv.addObject("e_sn", e_sn);
			mv.addObject("e_name", emp.getE_name());
		} catch (SQLException e) {
			e.printStackTrace();
			logger.error(e.getMessage());
			mv.setViewName("index/index");
		}

		return mv;
	}
	
	@RequestMapping("/index2")
	public ModelAndView  index2(HttpSession session) {
		ModelAndView mv = new ModelAndView();
		mv.setViewName("index/index2");
		return mv;
	}
}
